home *** CD-ROM | disk | FTP | other *** search
/ Windows 6-Pak - Disc 2 / Windows 6-Pak (InfoMagic) (Disc 2) (1999).ISO / File-Encryption-Utilities / cpx32.exe / SPECS.TXT < prev    next >
Encoding:
Text File  |  1998-09-14  |  11.7 KB  |  312 lines

  1.  
  2.                               CryptaPix (tm) 2.0
  3.                            Protocols and File Format
  4.                                (Revised 8/27/98)
  5.  
  6.  
  7. Program Description
  8. -------------------
  9.  
  10. CryptaPix is a 32-bit graphic image viewer for Windows based personal
  11. computers. CryptaPix features a symmetric encryption option that allows
  12. the user to encrypt industry standard BMP, GIF, JPG, PCX, PNG, and TIF
  13. images.  The ciphertext output file is in a proprietary format with an
  14. extension of CPX. It contains a full sized image, a thumbnail representation
  15. of the image in BMP format, an optional a WAV format sound clip, and the
  16. original filename.  All four sections are encrypted with either the PC1
  17. or Blowfish algorithms.
  18.  
  19.  
  20. Blowfish Algorithm
  21. ------------------
  22.  
  23. Blowfish is a fast, unpatented variable size-key block encryption
  24. algorithm invented by Bruce Schneier, security consultant and author of
  25. "Applied Cryptography" (Wiley, ISBN 0-471-11709-9).
  26.  
  27. The Blowfish algorithm used in CryptaPix follows the original specification
  28. as described in the April 1994 edition of Dr. Dobb's Journal and the
  29. second edition of "Applied Cryptography".
  30.  
  31. CryptaPix runs Blowfish with a 160-bit key in Cipher Block Chaining (CBC)
  32. mode.  An 8-byte initialization vector (IV) is generated from the
  33. compiler's (Borland Delphi) pseudo random number generator (PRNG).  The
  34. PRNG is seeded with data from the system clock at startup to ensure a
  35. unique IV for each file.
  36.  
  37.  
  38. PC1 Algorithm
  39. -------------
  40.  
  41. PC1 is a very fast, unpatented variable size-key stream cipher that
  42. produces an identical key stream as RSA Data Security Inc's RC4
  43. algorithm.  The algorithm follows the RC4 specification as described by
  44. Schneier in "Applied Cryptography".
  45.  
  46. CryptaPix runs PC1 with a key consisting of 40 or 80 bits of secret key
  47. material and 40 bits of salt provided by the compiler's PRNG.
  48.  
  49.  
  50. Export Restrictions
  51. -------------------
  52.  
  53. Due to U.S. export restrictions on encryption technology, the 80-bit PC1
  54. and 160-bit Blowfish algorithms are only available to registered users
  55. who reside in the U.S. or Canada.
  56.  
  57.  
  58. Key Generation
  59. --------------
  60.  
  61. Encryption keys are generated from the user's password.  Passwords can be
  62. up to 50 characters in length using any character available from the
  63. keyboard.  The user has the option of setting a "case sensitivity" flag at
  64. run-time which is saved in the header of the ciphertext file.  If this flag
  65. is disabled, the password is converted to uppercase.
  66.  
  67. Five bytes of random salt from the compiler's PRNG are appended to the
  68. password and then run through the Secure Hash Algorithm (SHA-1) to produce a
  69. 160-bit hash value.  The lower 40 or 80 bits from the hash output are used
  70. as the secret portion of the encryption key when the PC1 algorithm is used.
  71. All 160 bits are used with the Blowfish algorithm.  The SHA-1 algorithm
  72. conforms to FIPS PUB 180-1 specification as published by the National
  73. Institute of Standards and Technology (NIST).  The password salt is saved
  74. in the header of the ciphertext file.
  75.  
  76.  
  77. Key Confirmation
  78. ----------------
  79.  
  80. CryptaPix has a key confirmation feature that will determine if the user
  81. enters an incorrect password during decryption.  A 64-bit IV is filled
  82. with output from the compiler's PRNG.
  83.  
  84. For the PC1 algorithm, the first 40 bits of the IV are used as salt for
  85. the key.  The other 24 bits of the IV are not used.  The 40 or 80-bit
  86. encryption key is appended to the salt resulting in an 80 or 120-bit key.
  87. The PC1 engine is then cycled 10,000 times with results discarded.  Two more
  88. cycles are made and the 16-bit result is saved in the password check variable.
  89. When the Blowfish algorithm is used, the 64-bit IV is encrypted with the
  90. key and the lower 16 bits of the resulting ciphertext is saved in the
  91. password check variable.
  92.  
  93. Both the IV and the password check variable are saved in the ciphertext
  94. file's header.  During decryption, the IV is retrieved from the header and
  95. the process is repeated.  If the password check matches the stored value
  96. then the password is assumed to be correct and the decryption process
  97. continues.
  98.  
  99. The global IV/salt is only used for the password check.  Each encrypted
  100. section in the output file uses a unique IV/salt.
  101.  
  102.  
  103. CPX File Format
  104. ---------------
  105.  
  106. The default file extension for an encrypted CryptaPix file is ".CPX".
  107. CPX files begin with a file header, shown here in 32-bit Delphi format:
  108.  
  109. fheader = packed record
  110.             id: array[1..4] of char;
  111.             version: byte;
  112.             encryption: byte;
  113.             pwcase: boolean;
  114.             pwsalt: array[1..5] of byte;
  115.             pwiv: array[1..8] of byte;
  116.             pwcheck: word;
  117.             ioffset: integer;
  118.             tnoffset: integer;
  119.             woffset: integer;
  120.             fnoffset: integer;
  121.           end;
  122.  
  123. The id field is always 'CPIX'.
  124. The version field is 20 which represents version 2.0.
  125. The three possible values for the encryption field are:
  126.   1: 40-bit PC1
  127.   2: 80-bit PC1 (not available in exportable version)
  128.   3: 160-bit Blowfish (not available in exportable version)
  129. The pwcase field is true (1) if the user set the password case sensitivity
  130. flag, otherwise it is false (0).
  131. The pwsalt field is 5 bytes of random salt from the compiler's PRNG.  These
  132. bytes are appended to the user's password before hashing with SHA-1.
  133. The pwiv field is 8 random bytes form the compiler's PRNG.  When encryption
  134. method 3 is used, all 8 bytes are used as an initialization vector for the
  135. password confirmation feature.  When encryption methods 1 and 2 are used,
  136. the first 5 bytes are used as a key salt.
  137. The pwcheck field is used for password confirmation as described earlier.
  138. The ioffset field contains the file offset for the encrypted image header.
  139. The tnoffset field contains the file offset for the encrypted thumbnail
  140. header.
  141. The woffset field contains the file offset for the encrypted WAV sound clip
  142. header.
  143. The fnoffset field contains the file offset for the encrypted file name.
  144.  
  145.  
  146. Image Header
  147. ------------
  148.  
  149. The offset of the image header is specified by the ioffset field in the
  150. main file header.  The format for the image header is shown here in Pascal
  151. format:
  152.  
  153. iheader = packed record
  154.             id: array[1..6] of char;
  155.             ext: string[3];
  156.             size: integer;
  157.             iv: array[1..8] of byte;
  158.           end;
  159.  
  160.  
  161. The id field is always 'CPIX00';
  162. The ext field is set to the source image's file extension: 'BMP', 'GIF',
  163. 'JPG', 'PCX', 'PNG', or 'TIF'.
  164. The size field is the original image's file size in bytes.
  165. The iv field is 8 random bytes from the compiler's PRNG.  When encryption
  166. method 3 is used, all 8 bytes are used as an initialization vector.  When
  167. encryption methods 1 and 2 are used, the first 5 bytes are used as a key
  168. salt.
  169.  
  170. The encrypted image immediately follows the image header.  Random bytes are
  171. appended to the plaintext if necessary to make the output size a multiple
  172. of 8 bytes.
  173.  
  174.  
  175. Thumbnail Header
  176. ----------------
  177.  
  178. A thumbnail is a small (120 x 90 pixel) representation of the main image.
  179. CryptaPix creates it during the encryption process and saves it in a
  180. standard JPEG format.
  181.  
  182. The offset of the thumbnail header is specified by the tnoffset field in
  183. the main file header.  The format for the thumbnail header is shown here
  184. in Pascal format:
  185.  
  186. tnheader = packed record
  187.              id: array[1..6] of char;
  188.              size: integer;
  189.              iv: array[1..8] of byte;
  190.            end;
  191.  
  192. The id field is always 'CPIX01';
  193. The size field is the original thumbnail's file size in bytes.
  194. The iv field is 8 random bytes from the compiler's PRNG.  When encryption
  195. method 3 is used, all 8 bytes are used as an initialization vector.  When
  196. encryption methods 1 and 2 are used, the first 5 bytes are used as a key
  197. salt.
  198.  
  199. The encrypted thumbnail immediately follows the thumbnail header.  Random
  200. bytes are appended to the plaintext if necessary to make the output size a
  201. multiple of 8 bytes.
  202.  
  203.  
  204. WAV Header
  205. ----------
  206.  
  207. A WAV file is a sound clip in the industry standard WAV format.
  208.  
  209. The offset of the WAV header is specified by the woffset field in the main
  210. file header.  The format for the WAV header is shown here in Pascal format:
  211.  
  212. wheader = packed record
  213.             id: array[1..6] of char;
  214.             size: integer;
  215.             iv: array[1..8] of byte;
  216.           end;
  217.  
  218.  
  219. The id field is always 'CPIX02';
  220. The size field is the original WAV file size in bytes.  The size is set to
  221. 0 if no sound clip was saved with the file.
  222. The iv field is 8 random bytes from the compiler's PRNG.  When encryption
  223. method 3 is used, all 8 bytes are used as an initialization vector.  When
  224. encryption methods 1 and 2 are used, the first 5 bytes are used as a key
  225. salt.
  226.  
  227. The encrypted WAV sound immediately follows the WAV header.  Random bytes
  228. are appended to the plaintext if necessary to make the output size a
  229. multiple of 8 bytes.
  230.  
  231.  
  232. Filename Header
  233. ---------------
  234.  
  235. The original filename is stored in the CPX in an encrypted format.
  236.  
  237. The offset of the filename header is specified by the fnoffset field in the main
  238. file header.  The format for the filename header is shown here in Pascal format:
  239.  
  240. fnheader = packed record
  241.              id: array[1..6] of char;
  242.              size: integer;
  243.              iv: array[1..8] of byte;
  244.            end;
  245.  
  246.  
  247. The id field is always 'CPIX03';
  248. The size field is the length of the filename in bytes.
  249. The iv field is 8 random bytes from the compiler's PRNG.  When encryption
  250. method 3 is used, all 8 bytes are used as an initialization vector.  When
  251. encryption methods 1 and 2 are used, the first 5 bytes are used as a key
  252. salt.
  253.  
  254. The encrypted filename immediately follows the filename header as an array
  255. of characters.  Random bytes are appended to the plaintext if necessary to
  256. make the output size a multiple of 8 bytes.
  257.  
  258. Thumbnail Database Format
  259. -------------------------
  260.  
  261. CryptaPix stores thumbnails for non-encrypted images in central database
  262. files located in a directory specified by the user in the Options/Preferences
  263. section of the program.  A separate .tdb file is maintained for each disk
  264. volume using the disk's 8-digit hex serial number for the file name.  A
  265. corresponding index file with an .ndx extension contains sorted pointers for
  266. the .tdb file.
  267.  
  268. The .tdb file begins with this header:
  269.  
  270. tdbrec: packed record
  271.           id: array[1..7] of char;
  272.           ver: byte;
  273.           volume: string[255];
  274.           num: integer;
  275.         end;
  276.  
  277. The id field is 'CPIXTDB'.
  278. The ver field is 20, representing version 2.0.
  279. The volume field is the disk's volume label.
  280. The num field is the number of thumbnail records in the database.
  281.  
  282. Following the tdbrec header are the individual thumbnails, stored in a
  283. standard JPG format not exceeding 120 pixels in width or 90 pixels in
  284. height.  Just before each thumbnail is a thumbnail header:
  285.  
  286. tnrec: packed record
  287.          nextrec: integer;
  288.          name: string[255];
  289.          size: integer;
  290.        end;
  291.  
  292. The nextrec field contains the file offset of the next thumbnail header.
  293. The name field contains the full path name of the full size image file.
  294. The size field contains the number of bytes in the thumbnail.
  295.  
  296. A deleted thumbnail will have a blank file name and its data area filled
  297. with zeros.  Deleted and orphaned thumbnails can be physically removed
  298. from the database file with the thumbnail database maintenance functions.
  299.  
  300. The index file contains a list of 32-bit pointers (sorted by file name)
  301. that are offsets to the tnrec headers in the .tdb file.
  302.  
  303. ndxrec: packed record
  304.           id: array[1..7] of char;
  305.           ver: byte;
  306.         end;
  307.  
  308. The id field is set to 'CPIXNDX'.
  309. The ver field is set to 20, representing version 2.0.
  310.  
  311. ---End of File---
  312.